clear all
use "data/Afrobarometer_R9_clean_subset.dta",

*=====================================================*
  FIGURES 5–7 (same do-file)
*=====================================================*

*-----------------------------------------------------*
* Figure 5 — Predicted effect (Model 1: IV only)
*-----------------------------------------------------*
mixed govt_mismanage_index covid_corr_perc, || COUNTRY:, covariance(unstructured)
margins, at(covid_corr_perc=(0 1 2 3)) atmeans plot


*-----------------------------------------------------*
* Figure 6 — Predicted effect (Model 2: + individual controls)
*-----------------------------------------------------*
mixed govt_mismanage_index covid_corr_perc i.Survey_year i.Age i.Gender i.Location Education lived_poverty i.lost_income_to_COVID_19 econ_condition inst_trust_index govt_corr_index bribery_experience, || COUNTRY:, covariance(unstructured)

margins, at(covid_corr_perc=(0 1 2 3)) atmeans plot

*-----------------------------------------------------*
* Figure 7 — Cross-level interaction (Model 4)
*            covid_corr_perc × wgi_corr_ctrl
*-----------------------------------------------------*

Model 4: Cross-level interaction (COVID corruption × control of corruption)
mixed govt_mismanage_index covid_corr_perc i.Survey_year i.Age i.Gender i.Location Education lived_poverty i.lost_income_to_COVID_19 econ_condition inst_trust_index govt_corr_index bribery_experience V_DEM World_Bank_Governance_Indicators c.covid_corr_perc##c.World_Bank_Governance_Indicators, || COUNTRY:, covariance(unstructured) || covid_corr_perc:, covariance(unstructured)

  margins, at(World_Bank_Governance_Indicators=(-2.00 -1.00 0.00 1.00 2.00 ) covid_corr_perc=(0 1 2 3)) atmeans plot
  
  mplotoffset, offset(0.05)